package nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.lite.util.ContextUtil;
import ezy.lite.util.UI;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.adapter.ItemAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.Raffle;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.HowToCalActivity;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.UserAnswerActivity;

/**
 * Created by Administrator on 2016/3/12 0012.
 */
public class UserQuestionListAdapter extends ItemAdapter<String, UserQuestionListAdapter.UserQuestionHolder> {
    private Context context;

    public UserQuestionListAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public UserQuestionHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new UserQuestionHolder(inflate(R.layout.widget_question, parent));
    }

    @Override
    public void onBindViewHolder(UserQuestionHolder holder, int position) {
        String item = getItem(position);
       holder.txt_content.setText(item);
        holder.txt_content.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(context, UserAnswerActivity.class);
                intent.putExtra("poi",position);
                v.getContext().startActivity(intent);
            }
        });
    }


    static class UserQuestionHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        @BindView(R.id.txt_content)
        TextView txt_content;


        public UserQuestionHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            itemView.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {

        }
    }
}
